{% extends "mtTemplate.html" %}

{% block pageName %}BioVenturist Add Company Types{% endblock %}
{% block queryScriptMT %}
<!--<script type="text/javascript" src="/bvmtapp/static/js/mt_single_map_element_headquarter.js"></script>-->
<script type="text/javascript" src="/static/js/freebase_api.js"></script>
<script type="text/javascript" src="/bvmtapp/static/js/mt_single_map_element.js"></script>
<script type="text/javascript" src="/bvmtapp/static/js/mt_company_map_location.js"></script>
<script type="text/javascript" src="/static/js/form_elements.js"></script>
<script type="text/javascript" src="/bvmapapp/static/js/map.js"></script>

<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAPukT8vdX-9GHaeddb_T9XxQdwUW_lrS2P3w7zqRTJxdfml0W7hQE2JC34mbRmaRxg1y6cWlmwTWcAg"
      type="text/javascript"></script>
<!--<script type="text/javascript" src="/static/js/tooltip.js"></script>-->


<script language="javascript" type="text/javascript">


	perform_touch('{{ domain_used }}');

  	var q  = getBaseQuery();
		var url_read = "http://{{ domain_used }}/api/service/mqlread";
		var url_write = "http://{{ domain_used }}/api/service/mqlwrite";  
		var properties = get_properties();
		var num_elements_to_display = 1;
		//var mql = get_mql();
	
	mt_single_compound(url_read, url_write, q, properties, num_elements_to_display,true); 
	       
	//createHeadquarters_edit("span_headquarters", name, topic_type, topic_id, companyInfo.headquarters, domain_used, url_read);
	function load_info() {}
		//var url = "http://{{ domain_used }}/api/service/mqlread";
		
	//alert(q);
	//mt_single_compound(url_read, url_write, mql, properties, num_elements_to_display);
		// Create the search suggest for the filter
		//createCompanyFilter(bioventurist_dir, "company_filter", "company_filter_submit", 'map_div', url);
		// Load the map
		//loadMap(url, q);	
		//perform_freebase_read(
//		url,
//		q,
//		function (msg) {
//    
//        	companies = msg.result;
//			var companies_no_heaquarters_html = '';
//        	
//        	if(companies.length>0)
//			{		
//				
//				var num_comp_no_headquarters = 0;
//				alert(companies.length);
//        		for(var i=0; i<companies.length  ; i++)
//				{
//		        	var company = companies[i];
//		        	
//		        	var headquartersAll = company["/business/company/headquarters"];
//		        	var name = company.name;
//					var id=company.id;
//					//alert(name);
//		        	var htmlName = '<a href="/company' + company.id + '"target="_blank">' + name + '</a>'
//		        	
//		        	 // the company does not have a headquarters
//        				if(companies_no_heaquarters_html.length ==0)
//						{
//							
//							mql='{"query":[{"/business/company/headquarters":[{"/location/location/geolocation":[{"*":null,"optional":true}],"citytown":null,"postal_code":null,"state_province_region":null,"street_address":[],"optional":true}],"a:area_of_expertise":[{"name":null,"id":null,"optional":true}],"a:develops_treatments_for_disease":[{"name":null,"id":null,"optional":true}],"limit":10000,"name":"null","id":'+id+',"sort":"name","type":"/base/bioventurist/science_or_technology_company"}]}';
//							
//        					
//							
//        				}
//        				if(num_comp_no_headquarters<10)
//						{
//	        				companies_no_heaquarters_html += htmlName = '<a href="/company' + company.id + '"target="_blank">' + name + '</a>';
//    	    				companies_no_heaquarters_html += (i<companies.length-1? ', ' : '');
//        				}
//						 else 
//						 {
//        					if(num_comp_no_headquarters==10)
//							{
//        						companies_no_heaquarters_html += '...';
//        					}
//        				 }
//    					num_comp_no_headquarters = num_comp_no_headquarters+1;        				
//        		}
//        			
//        	}
//    	
//    		// Add the no_headquarters list to the page
//  //  		$('#list_vals').empty();
////    		$('#list_vals').append(companies_no_heaquarters_html);
////    		
//    	},
//		function(m){
//			var test = 0;
//		}
//	);
//	
//
//
//}

</script>

{% endblock %}

{% block col2_container %}

	Number of companies without address : <div id="num_companies"></div>
	<h2 class="demoHeaders">PLEASE PINPOINT THE LOCATION OF THE HEADQUARTERS OF:</h2>
	<br></br>
	<div id="list_vals"></div>
{% endblock %}

{% block tabs %}
{{companies}}	
{% endblock %}
	
